"""
Project Name : api_automation_framework
File Name : drip-demo.py
Author : lldhsds
Date : 2024/12/28 16:49
Description: /drip, Drips data over a duration after an optional initial delay.
"""

import requests

# /drip, Drips data over a duration after an optional initial delay.
# Parameters:(query)
    # duration(number): The amount of time(in seconds) over which to drip each byte. Default value: 2
    # numbytes(integer): The number of bytes to respond with. Default value: 10
    # code: The response code that will be returned. Default value: 200
    # delay: The amount of time(in seconds) to delay before responding. Default value: 2
# code: 200, A dripped response.
def drip_demo():
    url = "http://httpbin.org/drip"
    headers = {'Accept': 'application/octet-stream'}
    params = {
        "duration": 5.5,
        "numbytes": 10,
        "code": 200,
        "delay": 2
    }
    response = requests.get(url, headers=headers, params=params)
    print(response.status_code)
    print(response.text)
    print(response.content)
    print(response.headers)

drip_demo()
